#!/bin/sh

running_amd64_kernel() {
   uname -r | grep -qs 'amd64$'
}

case "$1" in
   kernel)
      boot_kernel="$2"
      if running_amd64_kernel ; then
         echo "$boot_kernel" | sed -e 's,/vmlinuz$,/vmlinuz2,'
      else
         echo "$boot_kernel"
      fi
      ;;
   initrd)
      boot_initrd="$2"
      if running_amd64_kernel ; then
         echo "$boot_initrd" | sed -e 's,/initrd\.img$,/initrd2.img,'
      else
         echo "$boot_initrd"
      fi
      ;;
   *)
      echo "Usage: $0 kernel|initrd" >&2
      exit 3
esac

exit 0
